<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品生产工序设计单查询</title>
</head>
<!-- 新 Bootstrap4 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">


<link rel="stylesheet" href="../../css/bootstrap-table.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>

<!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>

<!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>



<script src="../../js/bootstrap-table.min.js"></script>

<script src="../../js/bootstrap-table-zh-CN.min.js"></script>
<body>
<!--生产工序查询-->
<div class="modal fade" id="queryproductmoble">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--产品生产工序设计--制定产品生产工序设计单</h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body" style="background-color: darkgray;">
                <div style="display: flex;justify-content: flex-end">
                    <button type="button" class="btn btn-secondary"style="margin-left: 5px;" data-dismiss="modal">返回</button>
                </div>

                <div style="border: 1px solid black;margin-top: 10px; background-color: white;display: flex;flex-direction: column">
                    <h5 style="text-align: center;margin-top: 20px">生产工序设计单</h5>
                    <div style="display: flex;">
                        <div  style="margin-left: 10%;width: 40%;" >设计单编号：<span id="query_designId"></span></div>
                        <div style="width: 40%;display: flex"><div style="width: 23%">设计人：</div><span id="query_designer"></span></div>
                    </div>
                    <div  style="display: flex;margin-top: 5px;">
                        <div  style="margin-left: 10%;width: 30%;" >产品名称：<span id="query_productName"></span></div>
                        <div  style="margin-left: 10%;width: 40%;" >产品编号：<span id="sheng_productId"></span></div>
                    </div>
                    <div style="display: flex;">
                        <table class="table-sm  table-hover table-bordered" id="shengcahngtab" style="margin-left: 10%;margin-top: 5px;text-align: center" border="1" cellpadding="0" cellspacing="0" width="80%;">
                            <tr class="table-primary" style="color: white">
                                <td>工序序号</td>
                                <td>工序名称</td>
                                <td>工序编号</td>
                                <td>描述</td>
                                <td>工时数</td>
                                <td>工时单位</td>
                                <td>工时成本</td>
                                <td>工时成本小计（元）</td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <div  style="margin-left: 10%;width: 30%;margin-top: 5px;" >工时总成本：<span id="sheng_costPriceSum"></span></div>
                    </div>
                    <div  style="display: flex;margin-top: 5px;">
                        <div  style="margin-left: 10%;width: 30%;" >审核人：<span id="query_checker"></span></div>
                        <div  style="margin-left: 10%;width: 40%;" >审核时间：<span id="query_checkTime"></span></div>
                    </div>
                    <div style="display: flex;">
                        <div style="margin-left:10%;margin-top: 5px;display: flex;width: 100%;margin-bottom: 30px;">
                            设计要求：
                           <span id="query_procedureDescribe"></span>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

<div>
    <div class="form-inline">
        <label for="serach_product_name" style="margin-left: 100px;">产品名称：</label>
        <input id="serach_product_name" class="form-control">
        <label for="serach_product_name" style="margin-left: 30px;">审核状态：</label>
        <select class="form-control" id="serach_zt" >
            <option value="">请选择</option>
            <option>等待</option>
            <option>通过</option>
            <option>不通过</option>
        </select>
        <button  id="serach_query" class="btn btn-primary" style="margin-left: 30px;">点击搜索</button>
    </div>
</div>
<div>
    <table id="query_tab">

    </table>
</div>

<script>
    //查询所有工序
    $(function () {
        $("#query_tab").bootstrapTable({
            method: "post",
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            url: "/lc/qqueryallproductionprocesses",
            striped: true,
            pageNumber: 1,
            pagination: true,
            sidePagination: "server",
            pageSize: 3,
            pageList: [3, 5, 8, 10],
            queryParams: function (parms) {
                return {
                    pageNumber: (parms.offset / parms.limit) + 1,
                    pageSize: parms.limit,

                }
            },
            columns: [
                {title: "设计单编号", field: "designId", align: "center",
                    formatter:function (value,row,index) {
                        var a1="<a href='#' data-toggle=\"modal\" data-target=\"#queryproductmoble\" onclick='queryzz("+JSON.stringify(row)+")'>"+value+"</a>"
                        return a1;
                    }},
                {title: "产品编号", field: "productId", align: "center"},
                {title: "产品名称", field: "productName", align: "center"},
                {title: "审核状态", field: "checkTag", align: "center",
                    formatter: function (value, row, index) {
                    if(value=='S001-0'){
                        return "<span class='text-info'>等待审核</span>";
                    }else if(value=='S001-1'){
                        return "<span class='text-success'>审核通过</span>";
                    }else{
                        return "<span class='text-danger'>审核不通过</span>";
                    }
                //   return value=='S001-0'?'等待审核':value=='S001-1'?'审核通过':value=='S001-2'?'审核不通过':'';
                }
                },
            ],
        })
        $("#serach_query").click(function () {
            $("#query_tab").bootstrapTable("refresh")
        })
    })
    function  queryzz(zz) {
        $("#query_designId").text(zz.designId);
        $("#query_designer").text(zz.designer);
        $("#query_productName").text(zz.productName);
        $("#sheng_productId").text(zz.productId);
        $("#sheng_costPriceSum").text(zz.costPriceSum);
        $("#query_checker").text(zz.checker);
        $("#query_checkTime").text(zz.checkTime);
        $("#query_procedureDescribe").text(zz.procedureDescribe);
        $(".sheng_tr").remove();

        $.ajax({
            type:"POST",
            data:"id="+zz.id,
            url:"/lc/queryByidcheckmingxi",
            success:function (iddata) {
                $.each(iddata,function (index,d) {
                    $("#shengcahngtab").append("<tr class='sheng_tr'>" +
                        "<td>"+d.detailsNumber+"</td>" +
                        "<td>"+d.procedureName+"</td>" +
                        "<td>"+d.procedureId+"</td>" +
                        "<td></td>" +
                        "<td>"+d.labourHourAmount+"</td>" +
                        "<td>"+d.amountUnit+"</td>" +
                        "<td>"+d.costPrice+"</td>" +
                        "<td>"+d.subtotal+"</td>" +
                        "</tr>")
                })
            }
        })
    }
</script>
</body>
</html>